package com.league.blog.pojo;

import java.io.Serializable;
import java.util.List;

public class User implements Serializable {
    private Integer userId;

    private String accountName;

    private String userPassword;

    private String phone;

    private Integer userStatus;

    private String email;

    private String avatar;

    private Integer gender;

    private String introduction;

    private List<Role> roleList;

    private List<Permission> permissionList;

    private String nickName;

    public List<Role> getRoleList() {
        return roleList;
    }

    public void setRoleList(List<Role> roleList) {
        this.roleList = roleList;
    }

    public List<Permission> getPermissionList() {
        return permissionList;
    }

    public void setPermissionList(List<Permission> permissionList) {
        this.permissionList = permissionList;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public String getAccountName() {
        return accountName;
    }

    public void setAccountName(String accountName) {
        this.accountName = accountName == null ? null : accountName.trim();
    }

    public String getUserPassword() {
        return userPassword;
    }

    public void setUserPassword(String userPassword) {
        this.userPassword = userPassword == null ? null : userPassword.trim();
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone == null ? null : phone.trim();
    }

    public Integer getUserStatus() {
        return userStatus;
    }

    public void setUserStatus(Integer userStatus) {
        this.userStatus = userStatus;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email == null ? null : email.trim();
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar == null ? null : avatar.trim();
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public String getIntroduction() {
        return introduction;
    }

    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public void addPermission(Permission permission){
        if(null != permission){
            this.permissionList.add(permission);
        }
    }

    public void addPermission(List<Permission> permissions){
        if(permissions != null && permissions.size() > 0){
            this.permissionList.addAll(permissions);
        }
    }

    @Override
    public String toString() {
        return "User{" +
                "userId=" + userId +
                ", accountName='" + accountName + '\'' +
                ", userPassword='" + userPassword + '\'' +
                ", phone='" + phone + '\'' +
                ", userStatus=" + userStatus +
                ", email='" + email + '\'' +
                ", avatar='" + avatar + '\'' +
                ", gender=" + gender +
                ", introduction='" + introduction + '\'' +
                ", roleList=" + roleList +
                ", permissionList=" + permissionList +
                '}';
    }
}